#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int ways(vector<vector<int>> path){
    vector<vector<int>> direction {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
    
    if(path.size() == 13){
        return 1;
    }
    
    int count = 0;
    
    for(auto i : direction){
        int x = path.back()[0];
        int y = path.back()[1];
        vector<int> next = {i[0] + x, i[1] + y};
        
        if(find(path.begin(), path.end(), next) == path.end()){
            vector<vector<int>> path1 = path;
            path1.push_back(next);
            count += ways(path1);
        }
    }

    return count;
}

int main(int argc, char const *argv[])
{
    vector<vector<int>> path{{0,0}};
    cout << ways(path) << endl;

    return 0;
}
